<!-- reportingResults -->
<template>
    <div class="page">
        <!-- 导航栏 -->
        <!-- <div class="navBar">
            <customNavBar :leftTetx=leftTetx :titleTest=titleTest></customNavBar>
        </div> -->
        <div style="text-align: left; padding-left: 13px; margin-top: 30px;" @click="goreportingJst()">
            <img class='contentg' src="../../assets/img/features/closeIcon.png" alt="">
        </div>
        <div class='cetjecsty'>
            <span>链接已失效</span>
        </div>
        <div class="main">
            <!-- 页面内容 -->
            <div class="content">
                <div style="margin-top: 31px;">
                    <van-image width=46vw height=38vw :src="viewReport" />
                </div>
                <!-- <div>
                    <div class='progressd'>
                        该链接已失效
                    </div>
                </div> -->
                <div class='progressc' v-html="messagePrompt"></div>
                <!-- <div class='progressc'>
                    如您尚未完成<span>【保单检视全流程】</span>，可联系保险机构或服务人员重新邀请您使用本服务;
                </div>
                <div class='progressc'>
                    如已生成<span>【保单检视报告】</span>，您可在“金事通”app中保障分析服务模块查看此报告。
                </div> -->
                <!-- 您可通过以下途径查看报告:  -->
                <!-- <div class="progressb" style="margin-top: 30px;">
                1、联系保险机构或服务人员向您分享报告内容;
            </div>
            <div class="progressb">
                2、登录“金事通”app,在**模块查看已生成的保单检视报告。
            </div> -->
                <div class="btnStyle" v-if="showButton == 1">
                    <!-- <div @click="openjst">打开金世通APP</div> -->
                    <div @click="downloadjst">下载金事通APP</div>
                </div>
            </div>
        </div>
    </div>
    <div class='pageBj' v-if="showDialog">
        <div class="pageBjDiv">
            <div class='pageBjDivHeader'>温馨提示</div>
            <div class='pageBjDivsection'>您确认要退出本次服务吗?</div>
            <div class="pageBjDivBtoom">
                <div @click="onConfirm()">继续退出</div>
                <div @click="onCancel()">取消</div>
            </div>
        </div>
    </div>
</template>

<script lang="ts" setup name="reportingResultlecs">
import { useRouter, useRoute } from "vue-router"
import { Toast } from '/@/utils/Message';
import { onMounted } from "vue"
import { reactive, ref } from 'vue'
import customNavBar from "/src/components/NavBar/customNavBar.vue"
import viewReport from "../../assets/img/tast/jxs.png"

const router = useRouter()
const route = useRoute()
const leftTetx = ref("")
const titleTest = ref("链接超时")
const messagePrompt = ref(`如您尚未完成<span style="color: #007DFA; font-weight: bold;">【保单检视全流程】</span>，可联系保险机构或服务人员重新邀请您使用本服务;`);
const showButton = ref('0')
// const spanOne = ref("生成报告中，")
// const spanTwo = ref("请稍后...")
// const aText = ref("")


const spanOne = ref("已生成报告，请")
const aText = ref("查看报告")
const showDialog = ref<boolean>(false)

const onConfirm = () => {
    // window.location.replace('./reportingResultwxts')
    router.push({ path: 'reportingResultwxts' })
}
const onCancel = () => {
    // 取消操作
    showDialog.value = false;
}
const goreportingJst = (): void => {
    
    showDialog.value = true
}

const backHome = () => {

    // 获取 User Agent
    var userAgent = navigator.userAgent.toLowerCase();
    // 判断是否在微信中打开
    if (userAgent.indexOf('micromessenger') !== -1) {
        setTimeout(function () {
            //这个可以关闭安卓系统的手机
            document.addEventListener(
                "WeixinJSBridgeReady",
                function () {
                    WeixinJSBridge.call("closeWindow");
                },
                false
            );
            //这个可以关闭ios系统的手机
            WeixinJSBridge.call("closeWindow");
        }, 500);
    } else {
        console.log('当前页面不在微信中打开');
        if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") != -1) {
            window.location.href = "about:blank";
        } else if (userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1) {
            window.opener = null; window.open('about:blank', '_self', '').close();
        } else {
            window.opener = null;
            window.open("about:blank", "_self");
            window.close();
        }
    }

}
const checkDevice = () => {
        var userAgent = navigator.userAgent;if(/Android/i.test(userAgent)){return "Android"}else if(/iPhoneliPad|iPod/i.test(userAgent)){return "ios";}
        return userAgent;
}
const openjst = () => {
    var name = checkDevice()
    // var locatUrl = "weixin://";

    // if(/ipad|iphone|mac/i.test(navigator.userAgent)) {

    // var ifr =document.createElement("iframe");

    // ifr.src = locatUrl;

    // ifr.style.display = "none";

    // document.body.appendChild(ifr);

    // }else{

    // window.location.href = locatUrl;

    // }
}

const downloadjst = () => {
    var name = checkDevice()
    window.open("https://a.app.qq.com/o/simple.jsp?pkgname=com.sinosoft.csplatform")
}
onMounted(() => {
    if(route.query.showButton) {
        showButton.value = (route.query.showButton) as any
    }
    if(route.query.messagePrompt){
        messagePrompt.value  = (route.query.messagePrompt) as any
    }
})
</script>

<!-- less嵌套设置 -->
<style lang="less" scoped>
.pageBj {
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    position: absolute;
    align-items: center;
    justify-content: center;
    //   background: rgba(0,0,0,0.7);
    background-color: rgba(245, 247, 250, 1);

    .pageBjDiv {
        width: 300px;
        // padding: 10px 20px;
        border-radius: 10px;
        background: #ffffff;

        .pageBjDivHeader {
            margin-top: 17px;
            font-size: 14px;
            font-weight: bold;
        }

        .pageBjDivsection {
            margin-top: 17px;
            font-size: 13px;
        }

        .pageBjDivBtoom {
            display: flex;
            width: 100%;
            margin-top: 17px;
            justify-content: center;
            border-top: 1px solid #f3f3f3;

            div {
                padding: 10px 0;
                width: 50%;
            }

            div:last-child {
                color: #ffffff;
                background: #2c56ce;
                border-bottom-right-radius: 7px;
            }
        }
    }
}

.contentg {
    width: 30px;
    height: 27px;
}

.cetjecsty {
    font-weight: 600;
}

.page {
    background-color: #FFFFFF;
    // background-color: rgba(245, 247, 250, 1);
    height: 100vh;
    width: 100vw;
    overflow-x: hidden;

    .main {
        width: 100%;
        height: calc(100vh - 79px);
        overflow: hidden;

        .content {
            padding-top: 68px;
            padding-bottom: 50px;
            background-color: #fff;

            .progress {
                margin-top: 19px;
                margin-left: 20%;
                margin-right: 20%;
            }

            .progressd {
                // color: #222222;
                color: rgba(253, 54, 52, 1);
                font-size: 14px;
                font-weight: 600;
                margin-top: 22px;

                span {
                    color: #007DFA;
                }
            }

            .progressc {
                // width: 317px;
                width: 84%;
                max-width: 375px;
                margin: 0 auto;
                // margin-left: 34px;
                font-size: 14px;
                color: #222222;
                font-weight: 200;
                margin-top: 22px;
                text-align: left;
                letter-spacing: 1.7px;

                span {
                    color: #007DFA;
                    font-weight: bold;
                }
            }

            .btnStyle {
                width: 84%;
                margin: 0 auto;
                margin-top: 40px;
                display: flex;

                div {
                    margin: 0 auto;
                    flex: 1;
                    max-width: 250px;
                    height: 38px;
                    padding: 8px 12px;
                    border-radius: 18px;
                    text-align: center;
                    // margin-right: 20px;
                    font-size: 13px;
                    color: rgba(41, 139, 240, 1);
                    font-weight: 600;
                    line-height: 23px;
                    background: rgba(25, 138, 250, 0.06);
                    border: 1px solid rgba(25, 138, 250, 0.32);
                }

                div:last-child {
                    // border-right: 1px solid #000000;
                    // margin-left: 20px;
                }

            }

            .progressb {
                width: 317px;
                opacity: 0.7;
                font-size: 13px;
                color: #222222;
                font-weight: 500;
                text-align: left;
                margin-left: 34px;
                letter-spacing: 1.7px;
            }
        }
    }
}
</style>
